@extends('manage.layout')

@section('content')
    <section class="content-header">
        <h1>
            设置{{$seo->name}}详情页seo
            <small>Preview</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
            <li><a href="#">Case</a></li>
            <li class="active">Case Add</li>
        </ol>
    </section>

    <section class="content">
        <div class="row">
            <!-- left column -->
            <div class="col-md-12">
                <!-- general form elements -->
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title">内容</h3>


                    </div>

                    <!-- /.box-header -->
                    <!-- form start -->
                    <form action="{{ url('case/setSeo') }}" method="post" role="form" style="max-width: 800px;" enctype="multipart/form-data">
                        {{csrf_field()}}
                        <input type="hidden" name="_token" value="{{ csrf_token() }}">
                        <input type="hidden" name="id" value="{{$seo->id}}">
                        <div class="box-body">
                            <h2>注意：</h2>
                            在输入框中输入特定字符
                            <br>{字段名称}--->对应的字段值如：{name}--->案例的名称
                            <div class="form-group">
                                <label for="exampleInputPassword1">标题（30字以内）</label>
                                <input type="text" name="title" class="form-control" value="{{$seo->title}}" placeholder="请输入标题">
                            </div>
                            <div class="form-group">
                                <label for="exampleInputEmail1">关键字</label>
                                <textarea name="keyword" class="form-control" placeholder="请输入关键字">{{$seo->keyword}}</textarea>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputEmail1">网站描述</label>
                                <textarea name="description" class="form-control" placeholder="请输入网站描述">{{$seo->description}}</textarea>
                            </div>
                        </div>
                        <!-- /.box-body -->

                        <div class="box-footer">
                            <button type="submit" class="btn btn-primary">提交</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
@stop
@section('script')
    <script>
    //提交数据
    $(function() {
        $("form").submit(function(event) {
            event.preventDefault();
            var url = $(this).attr("action");
            var data = $("form").serialize();
            $.ajax({
                url: url,
                type: "POST",
                data: data,
                dataType: "json",
                success: function(res) {
                    console.log(res);
                    if(res.code == 100) {
                        window.location.href = window.location.href;
                        layer.msg(res.msg);
                    }
                    else {
                        layer.msg(res.msg);
                    }
                }
            });
        });
    });


    </script>
@stop
